package com.wangxiang.sys.manage.controller;

import com.wangxiang.common.utils.R;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;

@RestController

public class RedisController extends BaseController{
    @RequestMapping("redis/set/uni/register/captcha")
    public int setRedisUniRegisterCaptcha(@RequestBody HashMap<String , String> map){
        //所有验证码redis存储5分钟,uuid captcha
        String uuid = map.get("uuid");
        String captcha = map.get("captcha");
        redisUtils.set("uniRegisterUUID",uuid,300);
        redisUtils.set("uniRegisterCaptcha",captcha,300);
        if (redisUtils.get("uniRegisterUUID")==null|redisUtils.get("uniRegisterCaptcha")==null){
            //失败
            return 1;
        }
        return 0;
    }

    @RequestMapping("redis/get/uni/register/captcha")
    public HashMap<String , Object> getRedisUniRegisterCaptcha(){
        HashMap<String, Object> reMap = new HashMap<>();
        reMap.put("uniRegisterUUID",redisUtils.get("uniRegisterUUID"));
        reMap.put("uniRegisterCaptcha",redisUtils.get("uniRegisterCaptcha"));
        return reMap;
    }

    @RequestMapping("sys/redislogin/info/gateway")
    public boolean redisSet(@RequestBody HashMap<String ,Object> map){

        return true;
    }

}
